import 'package:dio/dio.dart';
import 'package:mall/core/models/address_list.dart';
import 'package:mall/core/models/business_apply.dart';
import 'package:mall/core/models/business_condition.dart';
import 'package:mall/core/models/business_level.dart';
import 'package:mall/core/models/business_type.dart';
import 'package:mall/core/models/point_transfer.dart';
import 'package:mall/core/models/store_detail.dart';
import 'package:mall/core/models/store_detail_req.dart';
import 'package:mall/core/models/store_index.dart';
import 'package:mall/core/models/store_index_req.dart';
import 'package:retrofit/http.dart';

part 'new_api.g.dart';

/// 服务接口
@RestApi()
abstract class NewApi {
  factory NewApi(Dio dio, {String baseUrl}) = _NewApi;

  /// 首页数据
  @POST('/api/store/index')
  Future<StoreIndex> storeIndex(@Body() StoreIndexReq req);

  /// 店铺详情
  @POST('/api/store/detail')
  Future<StoreDetail> storeDetail(@Body() StoreDetailReq req);

  /// 收货地址
  @GET('/api/address/list')
  Future<AddressList> addressList();

  /// 业务类型
  @GET('/api/business/apply')
  Future<List<BusinessType>> businessType();

  /// 业务级别
  @GET('/api/business/apply/{type}')
  Future<List<BusinessLevel>> businessLevel(@Path('type') String type);

  /// 业务条件
  @GET('/api/business/apply/{type}/{level}')
  Future<BusinessCondition> businessCondition(
    @Path('type') String type,
    @Path('level') String level,
  );

  /// 业务申请
  @POST('/api/business/apply')
  Future<List<BusinessApply>> businessApply(@Body() Map<String, dynamic> params);

  /// 积分转赠参数
  @GET('/api/point/transfer/param')
  Future<PointTransferParam> pointTransferParam();

  /// 积分转赠
  @POST('/api/point/transfer')
  Future pointTransfer(@Body() PointTransferReq req);

  /// 积分转赠查询参数
  @GET('/api/point/transfer/query/param')
  Future<PointTransferQueryParam> pointTransferQueryParam();

  /// 查询积分转赠历史
  @POST('/api/point/transfer/query')
  Future<PointTransferQueryRes> pointTransferQuery(@Body() PointTransferQueryReq req);
}
